/*
 * ASBarBetaApp.java
 */

package asbarbeta;

import javax.swing.JPanel;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 */
public class ASBarBetaApp extends SingleFrameApplication {
    private ASBarBetaView view;
    private LoginPanel loginPanel;
    private TableChoicePanel tableChoicePanel;
    private TablePanel tablePanel;
    private OrderPanel orderPanel;
    private MenuPanel menuPanel;
    private ChangeTablePanel changeTablePanel;
    
    /**
     * At startup create and show the main frame of the application.
     */
    @Override 
    protected void startup() {
        view = new ASBarBetaView(this);
        loginPanel = new LoginPanel(this);
        this.setViewComponent(loginPanel);
        show(view);
    }

    public ASBarBetaView getView() {
        return view;
    }
    
    public void setViewComponent(JPanel panel) {
        view.setComponent(panel);
        view.getComponent().setVisible(true);
    }
    
    public LoginPanel getLoginPanel() {
        return loginPanel;
    }
    
    public TableChoicePanel getTableChoicePanel() {
        tableChoicePanel = new TableChoicePanel(this);
        return tableChoicePanel;
    }
    
    public TablePanel getTablePanel() {
        tablePanel = new TablePanel(this);
        return tablePanel;
    }
    
    public OrderPanel getOrderPanel() {
        orderPanel = new OrderPanel(this);
        return orderPanel;
    }
    
    public MenuPanel getMenuPanel() {
        menuPanel = new MenuPanel(this);
        return menuPanel;
    }
    
    public ChangeTablePanel getChangeTablePanel() {
        changeTablePanel = new ChangeTablePanel(this);
        return changeTablePanel;
    }
    
    
    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override 
    protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of ASBarBetaApp
     */
    public static ASBarBetaApp getApplication() {
        return Application.getInstance(ASBarBetaApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(ASBarBetaApp.class, args);
    }
}
